package org.ucas.faker.web.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.ucas.faker.web.entity.Application;

import java.util.List;

/**
 * Created by suemi on 17-7-7.
 */
@Repository
public interface ApplicationDao extends JpaRepository<Application,String>{

  @Modifying
  @Query("DELETE FROM Application app")
  public void clear();

  @Query("SELECT app FROM Application app WHERE app.category = ?1")
  public List<Application> listByCategory(String category);
}
